package chess;

import java.awt.Point;
import java.util.ArrayList;
import java.util.List;

import chesskers.GamePiece;

public class KingPiece extends ChessPiece{
	
	public boolean canLeftCastle;
	public boolean canRightCastle;
	
	public KingPiece(boolean black, int x_, int y_) {
		super(black, x_, y_);
		
		canLeftCastle = false;
		canRightCastle = false;
		
		movePossibilities = new int[][][]{{{0, 1}}, {{0, -1}}, {{1, 0}}, {{1, 0}}, {{1, 1}}, {{1, -1}}, {{-1, 1}}, {{-1, -1}}};
		attackPossibilities = movePossibilities;
	}

	public String getName(){
		return "king";
	}

	
	@Override 
	public List<SpecialMove> getSpecialMovePossibilities() {
		List<SpecialMove> specialMoves = new ArrayList<SpecialMove>();
		if (canLeftCastle)
			specialMoves.add(new SpecialMove("kingleftcastle", new Point(x, y), new Point(x-1, y), new Point(x-3,y), new Point(x-3,y), SpecialMoveType.move));
		if (canRightCastle)
			specialMoves.add(new SpecialMove("kingrightcastle", new Point(x, y), new Point(x+1, y), new Point(x+4,y), new Point(x+4,y), SpecialMoveType.move)); 
		if (specialMoves.size() > 0)
			canSpecialMove = true;
		return specialMoves;
	}
}
